<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>待办任务</title>
</head>
<e:View id="view">
    <script type="text/javascript" src="<c:url value='/scripts/global.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
    <script type="text/javascript">SkinUtil.getSkin();</script>
    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
	<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
		<e:Dataset id="Dataset_FlowInstance" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="Dataset_FlowInstance" pageSize="10" loadDataCommand="Command_Load" allowMultiSelect="false">
			<e:Field name="instanceId" dataType="string" label="实例ID" maxLength="32" visible="false"/>
			 <e:Field name="templateId" dataType="string" label="流程类型" maxLength="32"  dropDown="DataDropDown_Template"/>				
			 <e:Field name="launcherId" dataType="string" label="启动人ID" maxLength="32" visible="false"/>
			 <e:Field name="launcher" dataType="string" label="申请人" maxLength="100" />				 
			 <e:Field name="launchTime" dataType="timestamp" label="申请时间" maxLength="11" />				 
			 <e:Field name="launcherOrgId" dataType="string" label="启动人机构ID" maxLength="32" visible="false"/>
			 <e:Field name="launcherOrgName" dataType="string" label="启动人机构名称" maxLength="100" visible="false"/>
		 	 <e:Field name="status" dataType="string" label="流程状态" maxLength="1"  visible="false"/>
			 <e:Field name="nodeName" dataType="string" label="当前处理结点" maxLength="32"  visible="false"/>
			 <e:Field name="nodeUrl" dataType="string" label="节点URL" maxLength="32"  visible="false"/>
			 <e:Field name="viewUrl" dataType="string" label="流程URL" maxLength="32"  visible="false"/>
		</e:Dataset>
		<e:Dataset id="Dataset_FlowTemplate" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="Dataset_FlowTemplate" pageSize="-1">
			<e:Field name="templateId" dataType="string" label="模板ID" maxLength="32" />
			 <e:Field name="templateName" dataType="string" label="模板名称" maxLength="100" />
			 <e:Field name="viewUrl" dataType="string" label="流程查看地址" maxLength="200" />
			 <e:Field name="remark" dataType="string" label="备注" maxLength="200" />
		</e:Dataset>			
		<e:DataDropDown id="DataDropDown_Template" dataset="Dataset_FlowTemplate" visibleFields="templateName"
				codeField="templateId" textField="templateName" autoDropDown="true" fixed="true" showColumnHeader="false" >
		</e:DataDropDown>
	</div>

<body>
<e:Page id="ePage" action="com.longtop.framework.sys.flow.web.FlowInstanceListAction" style="min-height: 80px; width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()">
	<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="left">
		<tr>
			<td>
				<e:Grid id="Grid_Task" style="width: 100%; height: 212px;" showIndex="true" dataset="Dataset_FlowInstance" readOnly="true" showIndicator="false"  onDblClick="RecordButton_Task_onClick()">
				</e:Grid>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<a href="#" title="查看所有待办任务" onclick="More_Task_onClick();" >更多...</a>
			</td>
		</tr>
	</table>
</e:Page>
</body>
</e:View>
</html>
<script type="text/javascript">
	//init
	function ePage_onAfterLoadPage(){
	}

	//【待办任务】查看
	function RecordButton_Task_onClick(){
		var dataset_Instance = $J("Dataset_FlowInstance");		//取得dataset
		var record = dataset_Instance.getCurrentRecord();	//取得当前record
		if(record) { 
			var instanceId = record.getString("instanceId");			//取得实例id
			var nodeUrl = record.getString("nodeUrl");
		
			var path = nodeUrl + "?instanceId=" + instanceId;
			openTab('do_' + instanceId, '处理流程', path);
		}
	}
	
	//【待办任务】查看更多
	function More_Task_onClick(){
		var path = "/jsp/framework/sys/flow/flowInstanceList.jsp";
		openTab("instance","流程审批跟踪",path);
	}
	
	//【待办任务】launchTime时间处理
	function launchTime_onRefresh(cell,value,record) {
		cell.innerHTML = value.substr(0,10);
	}
</script>